package com.sntk.organauthomanager.application.dto;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.sntk.organauthomanager.infrastructure.validation.Update;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @ClassName: UserDTO
 * @author: wgchao
 * @createTime: 2020/7/21 9:08 AM
 * @Description: TODO
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(content = JsonInclude.Include.NON_NULL)
@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY)
public class UserDTO implements Serializable {

    private Long id;

    //账户名-唯一
    @NotBlank(message = "账户名不能为空", groups = {Update.class})
    private String uname;

    //机构编号
    private String institutionNumber;

    //认证密码(加密后)
    private String password;

    //用户名称
    @NotBlank(message = "用户名称不能为空", groups = {Update.class})
    private String userName;

    private String hisCode;

    private Long hisDepartmentCode;

    //速记码
    private String shorthandCode;

    //联系电话
    private String phoneNumber;

    //用户类型 管理员/普通用户
    @NotNull(message = "用户类型不能为空", groups = {Update.class})
    private Integer userType;

    //备注
    private String remark;

    @NotNull(message = "禁用状态不能为空", groups = {Update.class})
    private Boolean disabled;

    private Boolean del;

    private Date createTime;

    private String creator;

    private Date lastUpdateTime;

    private String lastUpdator;

    //乐观锁 ObjectOptimisticLockingFailureException异常
    private Long version;
}
